package com.lbb.springboot.entity.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 测试枚举
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum UseBalanceTypeEnum {
    OPERATINGLICENSE(UserBalanceLogTypeEnum.OPERATINGLICENSE.getValue(),
            "营运照相片使用余额",
            "营运照相片使用红包"),
    GPS(UserBalanceLogTypeEnum.GPS.getValue(),
            "GPS下单使用",
            "GPS下单使用"),
    OPERATINGLICENSE_USE(3,
            "营运照相片使用余额",
            "营运照相片使用红包");

    private Integer type;
    private String remarks;
    private String redRemarks;


    UseBalanceTypeEnum(Integer type, String remarks, String redRemarks) {
        this.type = type;
        this.remarks = remarks;
        this.redRemarks = redRemarks;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getRedRemarks() {
        return redRemarks;
    }

    public void setRedRemarks(String redRemarks) {
        this.redRemarks = redRemarks;
    }

    public UseBalanceTypeEnum getByType(Integer type) {
        if (type == 1) {
            return UseBalanceTypeEnum.OPERATINGLICENSE;
        } else if (type == 1) {
            return UseBalanceTypeEnum.GPS;
        }
        return null;

    }

//    public static int getCodeByText(String text) {
//        for (lbbdContractLogOperationEnum it : lbbdContractLogOperationEnum.values()) {
//            if (it.text.equals(text)) {
//                return it.code;
//            }
//        }
//        return OPENlbbD.code;
//    }

    public static UseBalanceTypeEnum getTextByCode(Integer type) {
        if (type == null) {
            return null;
        }
        for (UseBalanceTypeEnum it : UseBalanceTypeEnum.values()) {
            if (it.type .equals(type)) {
                return it;
            }
        }
        return null;
    }
}


